﻿@{
    Layout = null;


}

<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>MVC新闻主页</title>
    <link href="../../Content/layout.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-1.8.0.min.js"></script>
    <script type="text/javascript">

      
        var modal = document.getElementById('myModal');


        $(document).ready(function () {
            var gch = localStorage.getItem("gch");
            var PeriodName = localStorage.getItem("PeriodName");
            var ISSN = localStorage.getItem("ISSN");
            var Publisher = localStorage.getItem("Publisher");
            $("#sname").text(PeriodName);
            $("#sissn").text(ISSN);
            $("#spub").text(Publisher);
            debugger;
                $.ajax({
                    url: '/home/GetDetail',
                    type: 'get',
                    async: false,
                    data: {
                        gch: gch
                    },
                    success: function (obj){                      
                        var year2023 = "<tr><td>2023年</td>";
                        var year2022 = "<tr><td>2022年</td>";
                        $("#tdyears").empty();
                        $.each(obj.Data, function (i, item) {
                            if (item.Years == 2023) {
                                year2023 += "<td name='tdnum' data-years=2023 data-vol='" + item.Vol + "' data-num='" + item.Num+"' >" + item.Num + "期</td>"
                            }
                            else {
                                year2022 += "<td name='tdnum'data-years=2022 data-vol='" + item.Vol + "' data-num='" + item.Num + "' >" + item.Num +"期</td>"
                            }
                        })
                        $("#tdyears").append(year2023 + "</tr>"+year2022 + "</tr>")
                        
                    }
                });

            $("[name=tdnum]").live('click', function () {
                //本地存储
                debugger;
                var num = $(this).attr("data-num");
                var years = $(this).attr("data-years");
                var vol = $(this).attr("data-Vol");
            //获取下载链接，判断用户名
                $.ajax({
                    url: '/home/GetDown',
                    type: 'get',
                    async: false,
                    data: {
                        gch: gch,
                        num: num,
                        years: years,
                        vol: vol,
                        panme:PeriodName
                    },
                    success: function (obj) {

                        if (obj.Status == -1) {
                            $("#myModal").show();
                           
                        }
                        else if (obj.Status == 1) {
                            alert("资源加载中.,请5分钟后在后台我的资源中查看")
                        }
                        else {
                            alert(obj.Msg)
                        }
                        // window.open(url + 'home/Detail', '_blank');
                    }
                });
            });

            $("#btnsub").live('click', function () {
                //本地存储
                var LoginName = $("#LoginName").val();
                var Pwd = $("#Pwd").val();
                //获取下载链接，判断用户名
                $.ajax({
                    url: '/admin/admin/Login',
                    type: 'post',
                    async: false,
                    data: {
                        LoginName: LoginName,
                        Pwd :Pwd,
                        IsAlways: true
                    },
                    success: function (obj) {
                        if (obj.Status == "ok") {
                            $("#myModal").hide();
                            alert("登录成功");

                        }
                        else {
                            alert("登录失败");
                            alert(obj.msg)
                        }
                        // window.open(url + 'home/Detail', '_blank');
                    }
                });
            });
            

            $(".close").click(function () {
                $("#myModal").hide();
            })
        })

    </script>


    <style type="text/css">

        table {
            width: 100%;
            border-collapse: collapse;
        }

        th, td {
            padding: 8px;
            text-align: left;
            border: 1px solid #1d0707;
            color: blue;
            cursor: pointer
        }

        th {
            background-color: #f2f2f2;
        }

        /* The Modal (background) */
        .modal {
            display: none; /* Hidden by default */
            position: fixed; /* Stay in place */
            z-index: 1; /* Sit on top */
            left: 0;
            top: 0;
            width: 100%; /* Full width */
            height: 100%; /* Full height */
            overflow: auto; /* Enable scroll if needed */
            background-color: rgb(0,0,0); /* Fallback color */
            background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
        }

        /* Modal Content/Box */
        .modal-content {
            background-color: #fefefe;
            margin: 15% auto; /* 15% from the top and centered */
            padding: 20px;
            border: 1px solid #888;
            width: 80%; /* Could be more or less, depending on screen size */
        }
    </style>

</head>

<body>
    <div id="container">
        <div id="header">
            <div id="logo"><img src="../../images/logo.gif" alt="企业名称" width="181" height="45" /></div>

        </div>
        <div class="clearfloat"></div>
        <div id="nav">
            <div id="nav_l"></div>
            <div id="nav_r"></div>
            <div class="nav_main">
                <ul>
                    <li><a href="~/home/index"><span>首页</span></a>  &nbsp;&nbsp; <a href="~/admin/admin/index"><span>后台</span></a></li></li>
                </ul>
            </div>

        </div>
        <div class="clearfloat"></div>
        <div id="maincontent">
            <div id="main">
                <div>


                    <div>
                        名字：<span id="sname"></span> <br />
                        出版社：<span id="spub"></span>  <br />
                        ISSN：<span id="sissn"></span> <br />

                    </div>

                    <div>
                        <table id="tdyears" class="table table-bordered"></table>
                    </div>
                </div>
            </div>
            <br />

            <!-- The Modal登录 -->
            <div id="myModal" class="modal">

                <!-- Modal content -->
                <div class="modal-content">
                    <span class="close">&times;</span>
                    <h2>请登录</h2>
                    
                    <form>

                        <label for="uname"><b>用户名</b></label>
                        <input type="text" placeholder="" name="LoginName" id="LoginName" required=required />

                        <label for="psw"><b>密码</b></label>
                        <input type="password" placeholder="" name="Pwd" id="Pwd" required=required />
                        <button id="btnsub">登录</button>
                        &nbsp;&nbsp;&nbsp;
                        <a href="/admin/admin/reguser">去注册</a>
                    </form>
                </div>
            </div>




        </div>



        <div class="clearfloat"></div>
        <div id="footer">
            <dl>
                <dt><a href="#">关于我们</a>　||　<a href="#">产品目录</a>　||　<a href="#">联系我们</a>　||　<a href="#">友情链接</a>　||　<a href="#">反馈问题</a>　||　<a href="#">广告合作</a></dt>
                <dd>
                    Copyright &copy; 2007 - 2010 aa25.cn   All Rights Reserved<br />
                    标准之路  版权所有  京ICP备10007159号
                </dd>
            </dl>
        </div>
    </div>


</body>
</html>
